package kr.hkit.powerjava.chapter15;

import java.awt.Color;

import javax.swing.BorderFactory;
import javax.swing.JColorChooser;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class ColorChooserPanel extends JPanel implements ChangeListener{

	private JColorChooser chooser;
	private Color color;
	
	/**
	 * Create the panel.
	 */
	public ColorChooserPanel() {
		chooser = new JColorChooser(Color.LIGHT_GRAY);
		chooser.getSelectionModel().addChangeListener(this);
		chooser.setBorder(BorderFactory.createTitledBorder("색상선택"));
		add(chooser);
	}
	

	@Override
	public void stateChanged(ChangeEvent e) {
		color = chooser.getColor();
		System.out.println(color);
	}
}


